tests: Insulate from user git environment
authorJosh Triplett <josh@joshtriplett.org>
Wed, 1 Mar 2017 23:50:15 +0000 (15:50 -0800)
committerJosh Triplett <josh@joshtriplett.org>
Thu, 2 Mar 2017 01:22:46 +0000 (17:22 -0800)
Several tests in "cargo test" would fail if the user had any of the Git
environment variables set for name or email address, because those
environment variables would override the tested configuration.  Filter
out those environment variables.

tests/cargotest/lib.rs

index 11df25fdd1363c26d996b60929a418cd86dd4cf3..5e8e7f5cbe4daaaed83b9d793ce719a494e4927f 100644 (file)
@@ -55,6 +55,11 @@ fn _process(t: &OsStr) -> cargo::util::ProcessBuilder {
      .env_remove("CARGO_INCREMENTAL")
      .env_remove("XDG_CONFIG_HOME")      // see #2345
      .env("GIT_CONFIG_NOSYSTEM", "1")    // keep trying to sandbox ourselves
+     .env_remove("EMAIL")
+     .env_remove("GIT_AUTHOR_NAME")
+     .env_remove("GIT_AUTHOR_EMAIL")
+     .env_remove("GIT_COMMITTER_NAME")
+     .env_remove("GIT_COMMITTER_EMAIL")
      .env_remove("CARGO_TARGET_DIR")     // we assume 'target'
      .env_remove("MSYSTEM");             // assume cmd.exe everywhere on windows